<?php

use Illuminate\Support\Facades\Route;


Route::any('/wechat/serve', 'Api\\Wechat\\MpWechatController@serve');

Route::any('/wechat/refund/notify', 'Api\\Wechat\\RefundController@notify')->name('wechat.pay.refund.notify');

Route::get('/home', 'HomeController@home');


Route::get('/wechat/{appid}/platform', 'LoginController@openPlatform');


Route::get('/captcha/image', 'CaptchaController@imageCaptcha');
// 发送手机验证码
Route::post('/captcha/sms', 'CaptchaController@sentSms');
// 手机短信注册
Route::post('/register/sms', 'RegisterController@smsHandler');
// 密码重置
Route::post('/password/reset', 'PasswordController@reset');

// 公众号鉴权
Route::get('/wechat/config', 'LoginController@wechatConfig');

// 密码登录
Route::post('/login', 'LoginController@passwordLogin');

// 手机验证码登录
Route::post('/login/mobile', 'LoginController@mobileLogin');


//授权方微信登录
Route::post('/login/douyin/session', 'LoginController@douyinSession');

//抖音sessionkey
Route::post('/login/douyin/session', 'LoginController@douyinSession');


//抖音sessionkey
Route::post('/login/douyin/session', 'LoginController@douyinSession');


//抖音昵称登录
Route::post('/login/douyin/login', 'LoginController@douyinLogin');


// 抖音小程序静默登录
Route::post('/login/douyin/silent', 'LoginController@douyinSilentLogin');


Route::post('/login/mini/session', 'LoginController@miniSession');

// 小程序手机号登录
Route::post('/login/mini/mobile', 'LoginController@miniMobileLogin');

// 小程序静默登录
Route::post('/login/mini/silent', 'LoginController@miniSilentLogin');

// 微信公众号扫码登录
Route::get('/login/wechat/scan', 'LoginController@wechatScan');
Route::get('/login/wechat/scan/query', 'LoginController@wechatScanQuery');

// 微信公众号授权登录
Route::get('/login/wechat/oauth', 'LoginController@wechatLogin');
Route::get('/login/wechat/oauth/callback', 'LoginController@wechatLoginCallback')->name('login.wechat.callback');

//app登录

Route::get('/login/wechat/app', 'LoginController@wechatAppLogin');
Route::get('/login/wechat/app/callback', 'LoginController@wechatAppLoginCallback')->name('api.v2.login.wechat.app.callback');


// 安全退出
Route::post('/logout', 'LoginController@logout')->middleware(['auth:apiv2']);

Route::get('/category/tree', 'CategoryController@tree');




Route::post('/chat/message/store', 'ChatRoomMessageController@sendMessage')->middleware(['auth:apiv2']);
Route::get('/chat/room', 'ChatRoomMessageController@detail')->middleware(['auth:apiv2']);



Route::group(['prefix' => 'aliyun'], function () {
    Route::post('/video/token/refresh', 'AliyunController@aliyunRefreshVideoToken');
    Route::post('/video/token/create', 'AliyunController@aliyunCreateVideoToken');
});
// 课程搜索
Route::group(['prefix' => 'search'], function () {

    Route::get('/', 'SearchController@index');
    Route::get('/keyword', 'SearchController@keyword');
    Route::get('/latest', 'SearchController@latest')->middleware(['auth:apiv2']);
    Route::delete('/delete', 'SearchController@delete')->middleware(['auth:apiv2']);


});


Route::get('/dashboard', 'DashboardController@index');
Route::post('/dashboard/chart', 'DashboardController@chart');

Route::group(['prefix' => 'user'], function () {

    Route::get('/{id}/detail', 'UserController@detail');
    Route::get('/{id}/family', 'UserController@family');
    Route::get('/{id}/relative', 'UserController@relative');
    Route::get('/{id}/conquers', 'UserController@conquers');
    Route::get('/{id}/conquer/{conquerId}/weight-fragment', 'UserController@weightFragmentByConquer');
    Route::get('/{id}/conquer/{conquerId}/weight-fragment/trend', 'UserController@weightFragmentTrendByConquer');
    Route::get('/{id}/conquer/{conquerId}', 'UserController@conquer');
    Route::get('/{id}/run', 'UserController@run');

});

Route::group(['prefix' => 'comment'], function () {
    Route::get('/{id}/answer', 'CommentController@answerComments')->middleware(['auth:apiv2']);
    Route::get('/{type}/{id}', 'CommentController@comments');
    Route::delete('/{id}', 'CommentController@delete');
    Route::post('/{type}/{id}/submit', 'CommentController@submitComment')->middleware(['auth:apiv2']);


});
Route::group(['prefix' => 'coupon'], function () {
    Route::get('/', 'CouponController@index')->middleware(['auth:apiv2']);
    Route::post('/{id}/claim', 'CouponController@claim')->middleware(['auth:apiv2']);
    Route::get('/{code}/check', 'CouponController@checkCode')->middleware(['auth:apiv2']);
});


Route::group(['prefix' => 'file'], function () {
    Route::get('/{id}', 'FileController@detail');
    Route::post('/list', 'FileController@list');
    Route::get('/{id}/download', 'FileController@download');
});
Route::group(['prefix' => 'thumbsup'], function () {
    Route::post('/{type}/{id}', 'ThumbsUpController@thumbsup')->middleware(['auth:apiv2']);
});
Route::group(['prefix' => 'appraise'], function () {
    Route::get('/obtain', 'AppraiseController@obtain')->middleware(['auth:apiv2']);
    Route::get('/entrance', 'AppraiseController@entrance')->middleware(['auth:apiv2']);
    Route::put('/choose', 'AppraiseController@choose')->middleware(['auth:apiv2']);
    Route::get('/recommends', 'AppraiseController@recommends');
    Route::get('/{type}/{id}', 'AppraiseController@appraises');
    Route::delete('/{id}/delete', 'AppraiseController@delete')->middleware(['auth:apiv2']);
    Route::post('/{type}/{id}/store', 'AppraiseController@store')->middleware(['auth:apiv2']);
});


//视频管理
Route::group(['prefix' => 'video'], function () {
    Route::get('/', 'VideoController@index');
    Route::get('/{id}', 'VideoController@detail');
    Route::post('/store', 'VideoController@store')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'VideoController@delete')->middleware(['auth:apiv2']);

});







Route::group(['prefix' => 'aliyun'], function () {
    Route::post('/create', 'AliyunController@aliyunCreateVideoToken');
    Route::post('/refresh', 'AliyunController@aliyunRefreshVideoToken');
    Route::post('/record/create', 'AliyunRecordController@aliyunCreateVideoToken');
    Route::post('/record/refresh', 'AliyunRecordController@aliyunRefreshVideoToken');
    Route::get('/encrypt', 'AliyunController@encryptVideo');
    Route::get('/decrypt', 'AliyunController@decrypt')->name('aliyun.video.decrypt');
    Route::post('/getInfo', 'AliyunController@getInfo');
    Route::post('/videoPlayInfo', 'AliyunController@videoPlayInfo');
    Route::post('/openPlayInfo', 'AliyunController@openPlayInfo');
    Route::post('/callback', 'AliyunController@callback');
});

Route::group(['prefix' => 'tag'], function () {
    Route::get('/', 'TagController@index');
    Route::get('/{id}', 'TagController@detail');
    Route::get('/category', 'TagController@category');
    Route::delete('/all', 'TagController@all');
    Route::get('/resources', 'TagController@resources');
    Route::get('/category/tree', 'TagCategoryController@tree');


});

Route::group(['prefix' => 'role'], function () {
    Route::get('', 'RoleController@index');
    Route::get('/appraise', 'RoleController@appraise');
    Route::get('/{id}/detail', 'RoleController@detail');
});


// 幻灯片
Route::get('/sliders', 'SliderController@all');

// 友情链接
Route::get('/links', 'LinkController@all');

// 首页导航
Route::get('/navs', 'NavController@all');

//尾部导航
Route::get('/footer_navs', 'FooterNavController@all');

// 公告
Route::get('/announcement/latest', 'AnnouncementController@latest');
Route::get('/announcement/{id}', 'AnnouncementController@detail');
Route::get('/announcements', 'AnnouncementController@list');


Route::group(['prefix' => 'other'], function () {
    // 系统常用配置
    Route::get('/config', 'OtherController@config');
});


Route::group(['middleware' => ['auth:apiv2', 'api.login.status.check']], function () {
    Route::group(['prefix' => 'order'], function () {

        Route::get('/', 'OrderController@index');
        Route::get('/{id}', 'OrderController@detail');
        Route::get('/{id}/info', 'OrderController@info');
        Route::get('/{id}/finish', 'OrderController@finishOrder');
        Route::post('/{id}/refund', 'OrderController@submitRefund');
        Route::put('/{id}/cancel', 'OrderController@cancel');
        Route::put('/{id}/address', 'OrderController@changeAddress');
        Route::get('/refund', 'OrderController@refundOrders');
        Route::delete('/refund/{id}', 'OrderController@deleteRefundOrder');
        Route::post('/recharge', 'OrderController@rechargeOrder');
        // 订单状态查询
        Route::get('/status', 'OrderController@queryStatus');
        Route::post('/product', 'OrderController@createProductOrder');

        // 微信小程序支付
        Route::post('/payment/wechat/mini', 'PaymentController@wechatMiniPay');
        //微信小程序充值
        Route::post('/payment/wechat/mini/recharge', 'PaymentController@wechatMiniRecharge');
        // 跳转到第三方平台支付[如：支付宝web支付]
        Route::get('/pay/redirect', 'PaymentController@payRedirect');
        // 手动打款支付
        Route::get('/pay/handPay', 'PaymentController@handPay');

        //手动付款
        Route::post('/transfer/store', 'OrderController@storeTransfer');
        // 微信扫码支付
        Route::post('/pay/wechatScan', 'PaymentController@wechatScan');
        // 获取可用支付网关
        Route::get('/payments', 'PaymentController@payments');
    });
});

Route::group(['prefix' => 'promoCode'], function () {
    // 优惠码检测
    Route::get('/{code}/check', 'PromoCodeController@checkCode')->middleware(['auth:apiv2']);
    Route::get('/promoCode/{code}', 'PromoCodeController@detail');
});
Route::group(['prefix' => 'redeemCode'], function () {
    // 优惠码检测
    Route::get('/', 'RedeemCodeController@index')->middleware(['auth:apiv2']);
    Route::get('/{id}/claim', 'RedeemCodeController@claim')->middleware(['auth:apiv2']);
    Route::post('/{type}/{id}/redeem', 'RedeemCodeController@redeem')->middleware(['auth:apiv2']);
    Route::get('/{id}/detail', 'RedeemCodeController@detail');


});

Route::post('/image/upload', 'ImageController@upload');
Route::delete('/image/{id}', 'ImageController@delete');
Route::delete('/image/{id}/destroy', 'ImageController@destroy');

Route::group(['middleware' => ['auth:apiv2', 'api.login.status.check']], function () {
    Route::group(['prefix' => 'my'], function () {
        Route::get('', 'MyController@index');
        // 关注的动态
        Route::get('/feed', 'MyController@feed');

        Route::get('/family', 'MyController@family');
        Route::get('/point', 'MyController@point');
        Route::get('/point', 'MyController@point');
        Route::get('/fragment', 'MyController@fragment');
        Route::get('/fulfill', 'MyController@fulfill');

        Route::get('/orders', 'MyController@orders');
        Route::get('/order/recharge', 'MyController@rechargeOrder');
        Route::get('detail', 'MyController@detail');
        Route::get('/recommends', 'MyController@recommends');

        //我的收藏分类列表
        Route::get('/favorite/category', 'MyController@favoriteCategory');
        //我的粉丝
        Route::get('/followers', 'MyController@followers');

        //我的减重
        Route::get('/conquer', 'MyController@conquer');




        //我的计划
        Route::get('/plan', 'MyController@plan');
        //减重下动态
        Route::get('/conquer/{id}/weight-fragment', 'MyController@weightFragmentByConquer');


        //孩子心愿
        Route::get('/wish', 'MyController@wish');

        //地址
        Route::get('/address', 'MyController@address');


        //孩子心愿
        Route::get('/run', 'MyController@run');

        //我的余额
        Route::get('/recharge/balance', 'MyController@recharge');


        //我的祝福
        Route::get('/blessing', 'MyController@blessing');


        //领取流水
        Route::get('/redpacket', 'MyController@redpacket');


        //红包充值流水
        Route::get('/blessing/balance', 'MyController@getBlessingBlance');


        //发的红包流水
        Route::get('/blessing/record', 'MyController@getBlessingRecord');


        //我的步数
        Route::get('/step', 'MyController@step');

        //我的小区
        Route::get('/district', 'MyController@district');

        //我的关注
        Route::post('/followings', 'MyController@followings');
        //关注
        Route::post('/follow', 'MyController@follow');
        //取消关注
        Route::delete('/unfollow', 'MyController@unfollow');


        // 密码修改
        Route::post('detail/password', 'MyController@passwordChange');
        // 头像修改
        Route::post('detail/avatar/upload', 'MyController@avatarUpload');
        Route::post('detail/bg/upload', 'MyController@bgImageUpload');

        // 昵称修改
        Route::post('detail/nickname', 'MyController@nicknameChange');

        Route::post('detail/brief', 'MyController@updateBriefIntroduce');
        // 手机号绑定[未绑定情况下]
        Route::post('detail/mobile', 'MyController@mobileBind');
        // 更换手机号
        // 我的通知
        Route::get('messages', 'MyController@messages');

        // 邀请余额明细
        Route::get('inviteBalanceRecords', 'MyController@inviteBalanceRecords');
        // 我的邀请注册用户
        Route::get('inviteUsers', 'MyController@inviteUsers');
        // 邀请余额提现记录
        Route::get('withdrawRecords', 'MyController@withdrawRecords');
        // 邀请余额提现
        Route::post('withdraw', 'MyController@createWithdraw');
        // 我的邀请码
        Route::get('promoCode', 'MyController@promoCode');
        // 我的优惠券
        Route::get('coupons', 'MyController@coupons');
        // 消息已读
        Route::get('notification/{notificationId}', 'MyController@notificationMarkAsRead');
        // 消息全部已读
        Route::get('notification/all', 'MyController@notificationMarkAllAsRead');
        // 未读消息数量
        Route::get('notification/count', 'MyController@unreadNotificationCount');
        // 积分明细
        Route::get('credit1Records', 'MyController@credit1Records');
        // 我的资料
        Route::get('profile', 'MyController@profile');
        Route::post('profile', 'MyController@profileUpdate');
        // 安全校验[手机号]
        Route::post('verify', 'MyController@verify');
        // 微信扫码登录绑定
        Route::get('wechatScan/bind', 'MyController@wechatScanBind');
        // 社交账号取消绑定
        Route::delete('socialite/{app}', 'MyController@socialiteCancelBind');
        // 社交账号绑定
        Route::get('socialite/{app}', 'MyController@socialiteBind');
        // 社交账号绑定
        Route::get('socialite/{app}', 'MyController@socialiteBind');
        // 微信公众号授权绑定
        Route::get('wechatBind', 'MyController@wechatBind');
        Route::get('/message', 'MyController@messages');
        Route::get('/roles', 'MyController@roles');
        Route::get('unreadFeedCount', 'MyController@unreadFeedCount');
        Route::get('credit1Records', 'MyController@credit1Records');
        Route::get('profile', 'MyController@profile');
        Route::post('profile', 'MyController@profileUpdate');
        Route::post('verify', 'MyController@verify');
        Route::get('socialite/{app}', 'MyController@socialiteBind')->middleware(['deprecated.api']);
        Route::get('wechatBind', 'MyController@wechatBind')->middleware(['deprecated.api']);
        Route::get('wechatBind/callback', 'MyController@wechatBindCallback')->name('api.v2.wechatBind.callback');
        Route::post('/relative/store', 'MyController@addRelative');
        Route::delete('/relative/{id}', 'MyController@deleteRelative');
        Route::put('/relative/{id}', 'MyController@updateRelativeName');
        Route::post('/relative', 'MyController@relative');
        Route::post('conquer/bg/upload', 'MyController@conquerBgImageUpload');



// 社交账号绑定回调
        Route::get('socialite/{app}/bind/callback', 'MyController@socialiteBindCallback')->name('api.v2.socialite.bind.callback');
    });
});



Route::group(['prefix' => 'conquer'], function () {

    Route::get('/', 'ConquerController@index');
    Route::get('/{id}', 'ConquerController@detail');
    Route::get('/{id}/private', 'ConquerController@detail1');
    Route::get('/{id}/notice', 'ConquerController@notice');
    Route::delete('/{id}', 'ConquerController@delete');
    Route::get('/{id}/edit', 'ConquerController@edit');
    Route::put('/{id}', 'ConquerController@update');
    Route::get('/{id}/user', 'ConquerController@attendUser');
    Route::post('/store', 'ConquerController@store')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'ConquerController@update')->middleware(['auth:apiv2']);
    Route::post('/image/upload', 'ConquerController@changeBg')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'ConquerController@delete')->middleware(['auth:apiv2']);
    Route::get('/{id}/fragment', 'ConquerController@fragment');
    Route::post('/{id}/attend', 'ConquerController@attend');
    Route::delete('/{id}/quit', 'ConquerController@quit');
    Route::get('/{id}/latest', 'ConquerController@latest');
    Route::get('/{id}/punch', 'ConquerController@punch');
    Route::put('/record/{id}', 'ConquerController@updateConquerRecord')->middleware(['auth:apiv2']);


});

Route::group(['prefix' => 'plan'], function () {

    Route::get('/', 'PlanController@index');
    Route::get('/{id}/detail', 'PlanController@detail');
    Route::get('/{id}/fragments', 'PlanController@fragment');
    Route::post('/store', 'PlanController@store')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'PlanController@delete')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'PlanController@edit')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'PlanController@update')->middleware(['auth:apiv2']);
    Route::get('/{id}/punch', 'PlanController@punch');
});

Route::group(['prefix' => 'wish'], function () {

    Route::get('/', 'WishController@index');
    Route::get('/{id}/detail', 'WishController@detail');
    Route::get('/{id}/fragments', 'WishController@fragment');
    Route::post('/store', 'WishController@store')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'WishController@delete')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'WishController@edit')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'WishController@update')->middleware(['auth:apiv2']);
    Route::post('/image/upload', 'WishController@changeBg')->middleware(['auth:apiv2']);


});

Route::group(['prefix' => 'run'], function () {

    Route::get('/', 'RunController@index');
    Route::get('/{id}/detail', 'RunController@detail');
    Route::get('/{id}/fragments', 'RunController@fragment');
    Route::post('/store', 'RunController@store')->middleware(['auth:apiv2']);
    Route::put('/receiver/{id}', 'RunController@updateRedpacket')->middleware(['auth:apiv2']);
    Route::post('/receiver/store', 'RunController@storeRedpacket')->middleware(['auth:apiv2']);
    Route::get('/receiver/{id}', 'RunController@editRedpacket')->middleware(['auth:apiv2']);
    Route::delete('/receiver/{id}', 'RunController@deleteRedpacket')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'RunController@delete')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'RunController@edit')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'RunController@update')->middleware(['auth:apiv2']);
    Route::get('/{id}/user/{userId}/red_packet', 'RunController@openRedpacket')->middleware(['auth:apiv2']);
    Route::put('/red_packet/reply/{id}', 'RunController@redpacketReply')->middleware(['auth:apiv2']);

});



Route::group(['prefix' => 'reward'], function () {

    Route::get('/', 'RewardController@index');
    Route::post('/store', 'RewardController@store')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'RewardController@delete')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'RewardController@edit')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'RewardController@update')->middleware(['auth:apiv2']);

});
Route::group(['prefix' => 'weight-fragment'], function () {
    Route::post('', 'WeightFragmentController@index');
    Route::post('/{id}/detail', 'WeightFragmentController@detail');
    Route::post('/store', 'WeightFragmentController@store')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'WeightFragmentController@edit')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'WeightFragmentController@update')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'WeightFragmentController@delete')->middleware(['auth:apiv2']);
    Route::get('/rank', 'WeightFragmentController@rankDaily')->middleware(['auth:apiv2']);
    Route::get('/compare', 'WeightFragmentController@compare')->middleware(['auth:apiv2']);
    Route::get('/user/{userId}/conquer/{conquerId}/images', 'WeightFragmentController@imagesByConquerAndDate');
    Route::get('/image/join', 'WeightFragmentController@joinImageComparison')->middleware(['auth:apiv2']);
    Route::delete('/image/{id}', 'WeightFragmentController@deleteImageComparison')->middleware(['auth:apiv2']);


});
Route::group(['prefix' => 'wish-fragment'], function () {
    Route::post('', 'WishFragmentController@index');
    Route::post('/store', 'WishFragmentController@store')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'WishFragmentController@edit')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'WishFragmentController@update')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'WishFragmentController@delete')->middleware(['auth:apiv2']);

});

Route::group(['prefix' => 'plan-fragment'], function () {
    Route::post('', 'PlanFragmentController@index');
    Route::post('/store', 'PlanFragmentController@store')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'PlanFragmentController@edit')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'PlanFragmentController@update')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'PlanFragmentController@delete')->middleware(['auth:apiv2']);

});


Route::group(['prefix' => 'family'], function () {
    Route::post('/store', 'FamilyController@store');
    Route::post('/{id}/member/store', 'FamilyController@storeMember');
    Route::post('/{id}/member/create', 'FamilyController@createMember');
    Route::delete('/{id}/member/{memberId}', 'FamilyController@deleteMember');
    Route::get('/member/{id}', 'FamilyController@editMember');
    Route::put('/member/{id}', 'FamilyController@updateMember');

});
Route::group(['prefix' => 'point'], function () {
    Route::post('/store', 'PointController@store')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'PointController@update')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'PointController@edit')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'PointController@delete')->middleware(['auth:apiv2']);

});



Route::group(['prefix' => 'favorite'], function () {
    Route::get('/category/{id}', 'FavoriteCategoryController@detail')->middleware(['auth:apiv2']);
    Route::get('/category', 'FavoriteCategoryController@index')->middleware(['auth:apiv2']);
    Route::get('/category/{id}/edit', 'FavoriteCategoryController@edit')->middleware(['auth:apiv2']);
    Route::post('/category/store', 'FavoriteCategoryController@store')->middleware(['auth:apiv2']);
    Route::put('/category/{id}/update', 'FavoriteCategoryController@update')->middleware(['auth:apiv2']);
    Route::delete('/category/{id}/delete', 'FavoriteCategoryController@delete')->middleware(['auth:apiv2']);
    Route::post('/{type}/{id}', 'FavoriteController@favorite')->middleware(['auth:apiv2']);

});

Route::group(['prefix' => 'district'], function () {
    Route::post('/store', 'DistrictController@store')->middleware(['auth:apiv2']);
    Route::get('/nearby', 'DistrictController@nearby')->middleware(['auth:apiv2']);
    Route::delete('/{id}/delete', 'AddressController@delete')->middleware(['auth:apiv2']);
    Route::put('/{id}/update', 'AddressController@update')->middleware(['auth:apiv2']);
    Route::get('/{id}/detail', 'AddressController@detail')->middleware(['auth:apiv2']);
});

Route::group(['prefix' => 'address'], function () {
    Route::post('/store', 'AddressController@store')->middleware(['auth:apiv2']);
    Route::delete('/{id}', 'AddressController@delete')->middleware(['auth:apiv2']);
    Route::put('/{id}', 'AddressController@update')->middleware(['auth:apiv2']);
    Route::get('/{id}/detail', 'AddressController@detail')->middleware(['auth:apiv2']);
    Route::get('/{id}', 'AddressController@edit')->middleware(['auth:apiv2']);
    Route::get('/{id}/default/set', 'AddressController@setDefaultAddress')->middleware(['auth:apiv2']);
});

Route::group(['prefix' => 'location'], function () {
    Route::get('/provinces', 'LocationController@getProvinces');
    Route::get('/cities', 'LocationController@getCities');
    Route::get('/districts', 'LocationController@getDistricts');
    Route::get('/streets', 'LocationController@getStreets');
});

Route::get('/provinces', 'DistrictController@getProvinces');
Route::get('/cities', 'DistrictController@getCities');
Route::get('/districts', 'DistrictController@getDistricts');
Route::get('/streets', 'DistrictController@getStreets');

Route::group(['prefix' => 'channel'], function () {
    Route::post('/store', 'ChannelController@store')->middleware(['auth:apiv2']);
    Route::put('/{id}/update', 'ChannelController@update')->middleware(['auth:apiv2']);
    Route::put('/{id}/detail', 'ChannelController@detail')->middleware(['auth:apiv2']);
    Route::delete('/{id}/delete', 'ChannelController@delete')->middleware(['auth:apiv2']);
    Route::get('/fragment/store', 'ChannelController@addFragment')->middleware(['auth:apiv2']);

});
Route::group(['prefix' => 'media'], function () {
    Route::get('/video/{id}/detail', 'MediaVideoController@detail');
    Route::get('/video/comment', 'MediaVideoController@comments');

});
Route::group(['prefix' => 'product'], function () {

    Route::get('/', 'ProductController@index');
    Route::get('/{id}', 'ProductController@detail');
    Route::post('/prize/redeem', 'ProductController@redeem')->middleware(['auth:apiv2']);


});





?>